home *** CD-ROM | disk | FTP | other *** search
/ Erotic Games: Memory / Erotic Games: Memory.iso / mac / air_installers / AdobeAIR.exe / setup.swf / scripts / mx / states / RemoveChild.as < prev    next >
Text File  |  2009-02-12  |  1KB  |  60 lines

  1. package mx.states
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.DisplayObjectContainer;
  5.    import mx.core.UIComponent;
  6.    import mx.core.mx_internal;
  7.    
  8.    use namespace mx_internal;
  9.    
  10.    public class RemoveChild implements IOverride
  11.    {
  12.       
  13.       mx_internal static const VERSION:String = "3.0.0.0";
  14.        
  15.       
  16.       private var removed:Boolean;
  17.       
  18.       private var oldIndex:int;
  19.       
  20.       private var oldParent:DisplayObjectContainer;
  21.       
  22.       public var target:DisplayObject;
  23.       
  24.       public function RemoveChild(param1:DisplayObject = null)
  25.       {
  26.          super();
  27.          this.target = param1;
  28.       }
  29.       
  30.       public function remove(param1:UIComponent) : void
  31.       {
  32.          if(removed)
  33.          {
  34.             oldParent.addChildAt(target,oldIndex);
  35.             if(target is UIComponent)
  36.             {
  37.                UIComponent(target).mx_internal::updateCallbacks();
  38.             }
  39.             removed = false;
  40.          }
  41.       }
  42.       
  43.       public function apply(param1:UIComponent) : void
  44.       {
  45.          removed = false;
  46.          if(target.parent)
  47.          {
  48.             oldParent = target.parent;
  49.             oldIndex = oldParent.getChildIndex(target);
  50.             oldParent.removeChild(target);
  51.             removed = true;
  52.          }
  53.       }
  54.       
  55.       public function initialize() : void
  56.       {
  57.       }
  58.    }
  59. }
  60.